home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / SML⁄NJ 93+ / Documentation / examples / spread / semant.sml < prev    next >
Encoding:
Text File  |  1995-12-30  |  334 b   |  11 lines  |  [TEXT/R*ch]

  1. structure Semant : FORMULA =
  2. struct
  3.      open Array infix 9 sub
  4.      type formula = int array array -> int
  5.      fun NUM i = fn a => i
  6.      fun CELLREF (e1,e2) = fn a => a sub e1 a sub e2 a
  7.      fun BINOP (f,e1,e2) = fn a => f(e1 a, e2 a)
  8.      fun IF (e1,e2,e3) = fn a => if e1 a <> 0 then e2 a else e3 a
  9.      val eval = fn x => x
  10. end
  11.